<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>soul-phone</title>
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/ajaxfileupload.js"></script>
	<script type="text/javascript">
		function sysArea(name,levelId,parentId,code){
			this.name=name;
			this.levelId=levelId;
			this.parentId=parentId;
			this.code=code;
		}
		function testInt(){
			var dataObj=new sysArea();
			dataObj.name='河北';
			dataObj.levelId='1';
			dataObj.parentId='0';
			dataObj.code='13';
			var url="sysArea/save.action"+"?date="+new Date();
			$.ajax({
			   type: "POST",
			   url:"sysArea/save.action",
			   data: "areaForm="+JSON.stringify(dataObj),
			   dataType: 'json',
			   success: function(map){
				   alert(map.status);
   				}});
		}
	</script>
	<style type="text/css">
		.background1{
			background-color: rgb(178, 136, 152);
		}
		.body{
			font-size: 18px;
		}
		.span{
			color:  #FF00A5;
			font-weight: strong
		}
		.div{
			color:  #FF00A5;
			font-weight: strong;
			height: 30px;
			width: 500px;
		}
		.div_1_3{
			height: 180px;
		}
		.a{
			color:  #FFFFFF;
		}
	</style>
  </head>
  
  <body class="background1 body">
  	<div class="div div_1_1">测试整合:<input onclick="testInt()">	</div>
  	<div class="div div_1_2"><span class="span attentionCode"> 获取二维码  </span></div>
  	<div class="div div_1_3"> <span class="span attentionImageSpan" style="display: none"><img class="img attentionImage" alt="二维码" src=""> </span></div>
  	<div class="div div_2_1"><div class="div getString">测试json </div></div>
  	<div class="div div_2_2 industryInfo">个人号发送消息 </div>
  	<div class="div div_2_3 wechatSendMeg">微信公众号发送消息</div>
  	<div class="div div_3_1 template">获取模板信息</div>
  	<div class="div div_3_2 payImage">获取支付二维码</div>
  	<div class="div div_3_3 payImageDiv" style="display: none"><img class="img payImageImg" alt="二维码" src=""> </span></div>
	<div class="div div_4_1 fileUpload">文件:<input id='file' name='file' type="file"> <span class="a submitFile">提交</span>  </div>
	<div class="div div_4_2 fileDownload">下载</div>
	<div class="div div_4_3 startVideo"><video src="sysArea/download.action" width="500" height="250" controls="controls">您的浏览器不支持此种视频格式。</video>  </div>
  </body>
  <script type="text/javascript">
  		$(".attentionCode").on('click',function(){
  			var imageUrl='scanCode/getCode.action';
  			$(".attentionImageSpan").css('display','block');
  			$(".attentionImage").attr('src',imageUrl);
//   			$.ajax({
//   			   type: "POST",
//   			   url:"sysArea/save.action",
//   			   data: "areaForm="+JSON.stringify(dataObj),
//   			   dataType: 'json',
//   			   success: function(map){
//   				   alert(map.status);
//      				}
//   			});
  		});
  		$(".getString").on('click',function(){
  			$.ajax({
			   type: "POST",
			   url:"sysArea/getString.action",
			   dataType: 'json',
			   success: function(map){
				   alert(map.status);
  				}
			});
  		});
  		//实现restful风格
  		$(".industryInfo").on('click',function(){
  			$.ajax({
  			  type: "POST",
			   url:"scanCode/getIndustryInfo.action",
			   data:"token=SWklCvq86TG9je8Kz_8p79Sl2cI-0A1DEOEJd5ZP0aM8A8EyAV_FOC1F3r-SHEdHipezAI6UG38ntWfr4xbz1CtSDWCoJ-fp69QY03fiLp-L-JVpf5B17vOOK3dSdMvoZQIaAAAPGY",
			   dataType: 'json',
			   success: function(map){
				 	alert(map);  
 				}
  			});
  		});
  		$('.wechatSendMeg').on('click',function(){
  			$(this).attr('disabled',true);
  			$.ajax({
    		   type: "POST",
  			   url:"sendMsg/feeMsg.action",
  			   dataType: 'json',
  			   success: function(map){
  				   
   				}
    			});
  		});
  		$('.template').on('click',function(){
  			$.ajax({
    		   type: "POST",
  			   url:"sendMsg/getTemplete.action",
  			   dataType: 'json',
  			   success: function(map){
  				   
   				}
    			});
  		});
  		$('.payImage').on('click',function(){
  			$.ajax({
  			   type: "POST",
   			   url:"scanCode/getDimenPayImage",
   			   dataType: 'json',
   			   success: function(map){
   				   console.log(map);
   				   $('.payImageImg').attr('src',map.imageUrl);
   				   $('.payImageDiv').css('display','block');
    			}
  			});
  		});
  		/**
			ajax文件上传  		
  		*/
  		$('.submitFile').on('click',function(){
  			$.ajaxFileUpload({
    			   url:"sysArea/fileUpload.action",
    			   fileElementId: 'file',
    			   dataType: 'json',
    			   success: function(map){
    				   console.log(map);
     			}
   			});
  		})
  		$('.fileDownload').on('click',function(){
  			window.location.href='sysArea/download.action';
//   			$.ajax({
//    			   type: "POST",
//     			   url:"sysArea/download.action",
//     			   dataType: 'json',
//     			   success: function(map){
//      			}
//    			});
  		})
  </script>
</html>
